package com.yc.demo.d0301Operation;

import com.google.gson.Gson;
import com.yc.demo.bean.Result;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;

@WebServlet(name = "likesServlet", value = "/likesServlet")
public class likesServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");

        //
        String[] likes = request.getParameterValues("likes");
        //从请求中获取会话对象
        final HttpSession session = request.getSession();

        String like = Arrays.toString(likes);

        session.setAttribute("likes", like);


    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
